package com.hitechbangla.fctu.form;

import com.hitechbangla.fctu.base.radar.Radar;
import com.hitechbangla.fctu.utility.enumall.AircraftPathShowOption;
import fctu.simulator.HTB_MAIN;

/**
 *
 * @author deb kanti
 */
public class AircraftPathOption extends javax.swing.JFrame 
{
    private HTB_MAIN htb_main;
    private AircraftPathShowOption aircraftPathShowOption;
    
    public AircraftPathOption(HTB_MAIN htb_main) 
    {
	initComponents();
	
	//jRadioButton1.setSelected(true);
	buttonGroup1.add(jRadioButtonDefaultPath);
	buttonGroup1.add(jRadioButtonFullPath);
	buttonGroup1.add(jRadioButtonPath1Blip);
	
	this.htb_main = htb_main;
	
	aircraftPathShowOption = htb_main.gameScene.radarList.get(0).getAircraftPathShowOption();
	
	if(aircraftPathShowOption == AircraftPathShowOption.DefaultPath)
	{
	    defaultPathSelected();
	}
	else if(aircraftPathShowOption == AircraftPathShowOption.FullPath)
	{
	    fullPathSelected();
	}
	else
	{
	    
	}	
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jRadioButtonDefaultPath = new javax.swing.JRadioButton();
        jRadioButtonFullPath = new javax.swing.JRadioButton();
        jRadioButtonPath1Blip = new javax.swing.JRadioButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setAlwaysOnTop(true);

        jRadioButtonDefaultPath.setText("Default Path");
        jRadioButtonDefaultPath.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonDefaultPathActionPerformed(evt);
            }
        });

        jRadioButtonFullPath.setText("Full Path");
        jRadioButtonFullPath.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonFullPathActionPerformed(evt);
            }
        });

        jRadioButtonPath1Blip.setText("Path 1 Blip");
        jRadioButtonPath1Blip.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonPath1BlipActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(31, 31, 31)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jRadioButtonPath1Blip)
                    .addComponent(jRadioButtonDefaultPath)
                    .addComponent(jRadioButtonFullPath))
                .addContainerGap(58, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(39, 39, 39)
                .addComponent(jRadioButtonDefaultPath)
                .addGap(18, 18, 18)
                .addComponent(jRadioButtonFullPath)
                .addGap(18, 18, 18)
                .addComponent(jRadioButtonPath1Blip)
                .addContainerGap(21, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jRadioButtonDefaultPathActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonDefaultPathActionPerformed
        
	defaultPathSelected();
	
	for(Radar radar: htb_main.gameScene.radarList)
	{
	    radar.setAircraftPathShowOption(AircraftPathShowOption.DefaultPath);
	}

	
    }//GEN-LAST:event_jRadioButtonDefaultPathActionPerformed

    private void jRadioButtonFullPathActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonFullPathActionPerformed
        
	fullPathSelected();
	
	for(Radar radar: htb_main.gameScene.radarList)
	{
	    radar.setAircraftPathShowOption(AircraftPathShowOption.FullPath);
	}
	
    }//GEN-LAST:event_jRadioButtonFullPathActionPerformed

    private void jRadioButtonPath1BlipActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonPath1BlipActionPerformed
        
	pathBlip1Selected();	
	
	for(Radar radar: htb_main.gameScene.radarList)
	{
	    radar.setAircraftPathShowOption(AircraftPathShowOption.Blip1Path);
	}
    }//GEN-LAST:event_jRadioButtonPath1BlipActionPerformed

    
    private void defaultPathSelected()
    {
	jRadioButtonDefaultPath.setSelected(true);
	jRadioButtonFullPath.setSelected(false);
	jRadioButtonPath1Blip.setSelected(false);
    }
    
    private void fullPathSelected()
    {
	jRadioButtonDefaultPath.setSelected(false);
	jRadioButtonFullPath.setSelected(true);
	jRadioButtonPath1Blip.setSelected(false);
    }
    
    private void pathBlip1Selected()
    {
	jRadioButtonDefaultPath.setSelected(false);
	jRadioButtonFullPath.setSelected(false);
	jRadioButtonPath1Blip.setSelected(true);
    }
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
	/* Set the Nimbus look and feel */
	//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
	 * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
	 */
	try {
	    for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
		if ("Nimbus".equals(info.getName())) {
		    javax.swing.UIManager.setLookAndFeel(info.getClassName());
		    break;
		}
	    }
	} catch (ClassNotFoundException ex) {
	    java.util.logging.Logger.getLogger(AircraftPathOption.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
	} catch (InstantiationException ex) {
	    java.util.logging.Logger.getLogger(AircraftPathOption.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
	} catch (IllegalAccessException ex) {
	    java.util.logging.Logger.getLogger(AircraftPathOption.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
	} catch (javax.swing.UnsupportedLookAndFeelException ex) {
	    java.util.logging.Logger.getLogger(AircraftPathOption.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
	}
	//</editor-fold>

	/* Create and display the form */
	java.awt.EventQueue.invokeLater(new Runnable() {
	    public void run() {
		//new AircraftPathOption().setVisible(true);
	    }
	});
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JRadioButton jRadioButtonDefaultPath;
    private javax.swing.JRadioButton jRadioButtonFullPath;
    private javax.swing.JRadioButton jRadioButtonPath1Blip;
    // End of variables declaration//GEN-END:variables
}
